<!Doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>登录博客后台</title>

    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="shortcut icon" th:href="@{/admin/images/favicon.png}"/>

    <script th:src="@{//cdn.bootcss.com/jquery/2.2.3/jquery.min.js}"></script>
    <script th:src="@{/jantent/assets/js/amazeui.min.js}"></script>
    <link rel="stylesheet" th:href="@{/jantent/assets/css/amazeui.min.css}"/>
    <link rel="stylesheet" th:href="@{/jantent/assets/css/app.css}"/>
    <script th:src="@{/admin/js/base.js}"></script>
</head>
<body>

<div class="log">
    <div class="am-g">
        <div class="am-u-lg-3 am-u-md-6 am-u-sm-8 am-u-sm-centered log-content">
            <h1 class="log-title am-animation-slide-top">登录Jantent</h1>
            <br>
            <form class="am-form" id="loginForm">

                <div class="am-input-group am-radius am-animation-slide-left">
                    <input type="text" class="am-radius" name="username"/>
                    <span class="am-input-group-label log-icon am-radius"><i
                            class="am-icon-user am-icon-sm am-icon-fw"></i></span>
                </div>
                <br>
                <div class="am-input-group am-animation-slide-left log-animation-delay">
                    <input  class="am-form-field am-radius log-input" placeholder="密码" name="password" type="password"/>
                    <span class="am-input-group-label log-icon am-radius"><i
                            class="am-icon-lock am-icon-sm am-icon-fw"></i></span>
                </div>
                <br>
                <button type="button"
                        class="am-btn am-btn-primary am-btn-block am-btn-lg am-radius am-animation-slide-bottom log-animation-delay"
                 onclick="checkForm()">
                    登&nbsp;录
                </button>
            </form>
        </div>
    </div>

    <footer class="log-footer">
        © 2018 Jantent
    </footer>
</div>

<script type="text/javascript">
    /*<![CDATA[*/
    var tale = new $.tale();
    function checkForm() {
        tale.post({
            url: '/admin/login',
            data: $("#loginForm").serialize(),
            success: function (result) {
                if (result && result.success) {
                    window.location.href = '/admin/index';
                } else {
                    tale.alertError(result.msg || '登录失败');
                }
            }
        });
        return false;
    }
    /*]]>*/
</script>
</body>
</html>